from PyQt5.QtWidgets import QMessageBox

'''消息框'''


def warning(title: str, text: str, buttons=QMessageBox.Ok):
    msgbox = QMessageBox()
    msgbox.setIcon(QMessageBox.Warning)  # 设置图标
    msgbox.setWindowTitle(title)  # 设置标题
    msgbox.setText(text)  # 设置内容
    msgbox.setStandardButtons(buttons)  # 设置按钮
    reply = msgbox.exec()  # 返回用户点击结果
    return reply


def information(title: str, text: str, buttons=QMessageBox.Ok):
    msgbox = QMessageBox()
    msgbox.setIcon(QMessageBox.Information)  # 设置图标
    msgbox.setWindowTitle(title)  # 设置标题
    msgbox.setText(text)  # 设置内容
    msgbox.setStandardButtons(buttons)  # 设置按钮
    reply = msgbox.exec()  # 返回用户点击结果
    return reply
